package sg.edu.nus.iss.team4.common.exception;

public abstract class SurveyCommonException extends Exception {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -502596823249877782L;
	private int errorCode = 0;
	protected int CRITICAL_LEVEL = 9999;
	
	public SurveyCommonException(String desc,int errorCode){
		super(desc);
		this.errorCode=errorCode;
		setCriticalLevel();
	}
	
	public SurveyCommonException(String desc,int errorCode,Exception e){
		super(desc,e);
		this.errorCode=errorCode;
		setCriticalLevel();
	}
	
	public boolean isCritical(){ 
		if(this.errorCode > CRITICAL_LEVEL){
			return true;
		}else
			return false;
	}
	
	public int getErrorCode(){
		return this.errorCode;
	}
	
	protected abstract void setCriticalLevel();

}
